﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography;

namespace BUS_QLNS.Tools
{
    public class Hash
    {
        public static string HashWithSalt(string Password, string Salt)
        {
            string sHashWithSalt = Salt + Password + Salt;
            byte[] SaltedHashBytes = Encoding.UTF8.GetBytes(sHashWithSalt);
            HashAlgorithm algorithm = new System.Security.Cryptography.SHA256Managed();
            byte[] Hash = algorithm.ComputeHash(SaltedHashBytes);
            return Convert.ToBase64String(Hash);
        }
    }
}
